package com.project.thisDatabase.base.model.data;

import com.project.annotation.enums.data.ConditionType;
import lombok.Data;

@Data
public class Condition<T> {

    private T body;
    private Condition<T> child;
    private Integer type = ConditionType.and;

    public Condition(T body) {
        this.body = body;
    }

    public Condition<T> or(T item) {
        this.child = new Condition<T>(item);
        this.type = ConditionType.or;
        return this.child;
    }

    public Condition<T> and(T item) {
        this.child = new Condition<T>(item);
        this.type = ConditionType.and;
        return this.child;
    }

    public Condition<T> not(T item) {
        this.child = new Condition<T>(item);
        this.type = ConditionType.not;
        return this.child;
    }
}
